package cn.qh.com.entity;

import java.util.Date;


import cn.qh.com.annotationverification.AnnotationSort;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;

import lombok.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotBlank;

/**
 * (Brand)表实体类
 *
 * @author makejava
 * @since 2021-11-26 11:00:09
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "brand")
@SuppressWarnings("serial")
public class Brand extends Model<Brand> {
    @TableId(type = IdType.AUTO)
    private int id; //主键


    @TableField(value = "name")
    @NotBlank(message = "品牌名输入不能为空")
    @Length(min = 5, max = 50, message = "品牌名必须大于5位,小于50位")
    private String name;  //品牌名


    @TableField(value = "logo")
    @NotBlank(message = "品牌logo不能为空")
    @URL(message = "url路径必须正确！")
    private String logo;  //品牌logo


    @TableField(value = "letter")
    private String letter;  //首字母


    @TableField(value = "description")
    private String description;  //品牌的描述


    @AnnotationSort
    @TableField(value = "sort")
    private Integer sort;  //排序


    @Version
    private int version;   //版本


    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private int deleted;  //逻辑删除标志


    @TableField(value = "createdTime", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;  //创建时间


    @TableField(value = "updatedTime", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;  //修改时间
}
